import 'package:flutter/material.dart';
import 'package:yuan_hang_app/base/full_base_page.dart';
import 'package:yuan_hang_app/res/w_colors.dart';
import 'package:yuan_hang_app/res/w_dimens.dart';
import 'package:yuan_hang_app/utils/size_utils.dart';
import 'package:yuan_hang_app/widget/funnel_chart.dart';
import 'package:yuan_hang_app/widget/w_line.dart';
import 'package:yuan_hang_app/widget/w_text.dart';

class SaleFunnelPage extends StatefulWidget {
  const SaleFunnelPage({super.key});

  @override
  State<SaleFunnelPage> createState() => _SaleFunnelPageState();
}

class _SaleFunnelPageState extends State<SaleFunnelPage> {
  List funnelList = [
    {
      "label": "线索",
      "count": 115,
    },
    {
      "label": "到店",
      "count": 88,
    },
    {
      "label": "试驾",
      "count": 39,
    },
    {
      "label": "订单",
      "count": 5,
    }
  ];

  @override
  Widget build(BuildContext context) {
    return FullBasePage(
        title: "销售漏斗",
        child: Column(
          children: [
            Container(
              margin: EdgeInsets.only(top: 10.px, right: 10.px, left: 10.px),
              padding: EdgeInsets.symmetric(vertical: 10.px, horizontal: 10.px),
              decoration: BoxDecoration(
                  color: WColors.white,
                  borderRadius: BorderRadius.circular(10.px)),
              child: Column(
                children: [
                  WText(
                    "漏斗图",
                    style: TextStyle(
                        color: WColors.mainTextColor,
                        fontSize: WDimens.tsLarge),
                  ),
                  WLine(
                    height: 0.5.px,
                    marginTop: 10.px,
                    marginBottom: 10.px,
                  ),
                  CustomPaint(
                    size:
                        Size(SizeUtils.screenW(), (funnelList.length) * 61.px),
                    painter: FunnelChart(
                      dataList: funnelList,
                    ),
                  ),
                ],
              ),
            )
          ],
        ));
  }
}
